package com.yrmao.chiefenergyofficer.ui;

import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.view.WindowManager;

import com.yrmao.chiefenergyofficer.R;
import com.yrmao.chiefenergyofficer.ui.common.BaseActivity;

public class SplashUI extends BaseActivity {
    private Handler handler;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.ac_splash);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            //透明状态栏
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            //透明导航栏
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
        }
        init();

    }

    private void init() {
        handler = new Handler();
        handler.postDelayed(runnable, 500);//两秒后发送消息

    }

    Runnable runnable = new Runnable() {
        @Override
        public void run() {
            toMainActiviyTool();
            finish();

        }
    };

    private void toMainActiviyTool() {
        startActivity(new Intent(this, MainActivityTool.class));
    }
}
